#pragma once

#include "fxcc/core/pch.h"

namespace fxcc
{
	namespace imgui
	{

		struct FXCC_API Cmd
		{
			std::string m_Name{"cmd(null)"};

			Cmd() = default;
			
			Cmd(const std::string& name) :m_Name(name)
			{

			}
			virtual void Undo() {}
			virtual void Do() {};

		};

		struct FXCC_API CmdList
		{
			std::vector<std::shared_ptr<Cmd>> m_Lefts;
			std::vector<std::shared_ptr<Cmd>> m_Rights;

			void Do() {
			
				auto cmd = m_Lefts[m_Lefts.size() - 1];
				cmd->Do();
				m_Rights.push_back(cmd);
				m_Lefts.pop_back();
			}
			void UnDo()
			{
				auto cmd = m_Rights[m_Lefts.size() - 1];
				cmd->Do();
				m_Lefts.push_back(cmd);
				m_Rights.pop_back();
			}

		};
	};
};